<!DOCTYPE html>
<html>
<head>
    <include file="./public/sty.html"/>
    <style>
        .anModebtn{background: #ff9932; margin-top:20px; border:none;}
        .anModebtn{width: 100%; height: 100%; background: none; cursor: pointer; color: #fff; font-size: 16px;}
        .yz1,.yz2,.yz3,.yz4,.yz5,.yz6{text-align: left !important; margin-left: 20px;}
        .yz1 :before,.yz2 :before,.yz3 :before,.yz4 :before,.yz5 :before,.yz6 :before{ font-family: iconfont;
            font-style: inherit;
            padding: 0 5px;
            font-size: 14px;content: "\E60D";}
    </style>
</head>
<body>
<div id="app" class="register">
    <include file="./public/header.html"/>

    <div class="container registerPage" s="[object Object]"><h3 class="reg_tit">用户注册</h3>
        <p class="reg_small">
            <ins>罗纳尔多</ins>
            都已经注册了，赶紧加入吧！注册后系统将随机分配一张个性的头像。
        </p>
        <form action="{:U('Yz/zhuce_add')}" method="post" enctype="multipart/form-data" id="form">
        <ul class="submitContent regMain">
            <li><span>邀请码：</span> <input type="text" name="yaoqingma" id="yaoqingma" placeholder="请输入邀请码" value="{$code}" > <span class="yz1" style="width: 300px"></span> <!----></li>
            <li><span>账号：</span> <input type="text" name="user" id="user" placeholder="请输入账号" style=""><span class="yz2" style="width: 300px"></span><!----></li>
            <li><span>设置密码：</span> <input type="password" name="pass" id="pass1" placeholder="请输入密码"> <span class="yz3" ></span><!----></li>
            <li><span>确认密码：</span> <input type="password" name="pass" id="pass2"  placeholder="请再次输入密码" ><span class="yz4" style="width: 300px"></span> <!----></li>
            <li style="position: relative;"><span>验证码：</span> <input placeholder="请输入验证码" id="yanzhengma" type="text" class="userInput"> <!---->
                <span class="anym" style="width: 0px; padding:0; margin:0;">
                    <img id="yzm"  name="yzm" src="/index.php/Api/Swimer/yzm" onclick="this.src='/index.php/Api/Swimer/yzm/time='+Math.random();" style="cursor: pointer;" width="97px" title="点击获取"/>
                </span><span class="yz5" style="width: 300px"></span>
            <li>

            <p style="display: inline; margin-left: 0px; font-size: 12px; color: rgb(154, 154, 154);">
                <input type="checkbox" name="box" id="box" value="1" style="width: inherit; margin-right: 5px;margin-left: 150px">我已经年满18岁
                    <span class="Validform_checktip"></span></p> </span><span class="yz6" style="width: 300px"></span></li>
            <li><a  onclick="sav()" class="mainColorBtn submitBtnBig ClickShade" style="margin-left: 100px">注 册</a>
                <a  href="{:U('Index/register')}" class="mainColorBtn submitBtnBig ClickShade" style="margin-left: 60px;background-color: grey">重 置</a>
            </li>
        </ul>
    </form>
    </div>

    <include file="./public/footer.html"/>
   

    <div data-v-0835e1db="" class="layermbox layermbox2 layermshow" style="display: none;">
        <div data-v-0835e1db="" class="laymshade"></div>
        <div data-v-0835e1db="" class="layermmain">
            <div data-v-0835e1db="" class="section">
                <div data-v-0835e1db="" class="layermchild  layermanim">
                    <div data-v-0835e1db="" class="layermcont"><i data-v-0835e1db=""></i> <i data-v-0835e1db=""
                                                                                             class="laymloadtwo"></i> <i
                            data-v-0835e1db=""></i>

                        <div data-v-0835e1db=""></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script>

function sav(){
    var box = $("#box").is(":checked");
    var yaoqingma = $("#yaoqingma").val();
    var user = $("#user").val();
    var pass1 = $("#pass1").val();
    var pass2= $("#pass2").val();
    var yanzhengma = $("#yanzhengma").val();
    if(yaoqingma == ''){
        $(".yz1").html("<font color='red'>邀请码不能为空</font>");
        return false;
    }else {
        $(".yz1").html("");
    }

    if(user == ''){
        $(".yz2").html("<font color='red'>账号不能为空</font>");
        return false;
    }else {
        $(".yz2").html("");
    }
    if(user.length < 6 || user.length > 20 ){
        $(".yz2").html("<font color='red'>账号必须是6~20位字母数字或下划线组合</font>");
        return false;
    }else {
        $(".yz2").html("");
    }
    if(pass1 == ''){
        $(".yz3").html("<font color='red'>密码不能为空</font>");
        return false;
    }else {
        $(".yz3").html("");
    }
    if(pass1.length < 6 || pass1.length > 20 ){
        $(".yz3").html("<font color='red'>密码必须是6~20位</font>");
        return false;
    }else {
        $(".yz3").html("");
    }
    if(pass2 == ''){
        $(".yz4").html("<font color='red'>确认密码不能为空</font>");
        return false;
    }else {
        $(".yz4").html("");
    }
    if(pass1 != pass2){
        $(".yz4").html("<font color='red'>两次输入的密码不一致</font>");
        return false;
    }else {
        $(".yz4").html("");
    }
    if(yanzhengma == ''){
        $(".yz5").html("<font color='red'>验证码不能为空</font>");
        return false;
    }else {
        $(".yz5").html("");
    }
    if(!box){
        $(".yz6").html("<font color='red'>未满18周岁不能注册，请选择</font>");
        return false;
    }else {
        $(".yz6").html("");
    }

    $.ajax({
        type: "POST",
        url: "{:U('Yz/zhuce_add')}",
        data: {'user':user,'pass':pass1,'yanzhengma':yanzhengma,'yaoqingma':yaoqingma},
        success: function(dat){
            if(dat==1){
                $(".yz2").html("<font color='red'>该账号已存在，请直接登录</font>");
            }else if(dat==2){
                $(".yz1").html("<font color='red'>邀请码不正确，请重新输入</font>");
            }else if(dat==0){
                $(".yz5").html("<font color='red'>验证码不正确，请重新输入</font>");
            }else if(dat==3){
                window.location.href="{:U('Index/login')}";
            }
        }
    });

}






</script>